package com.lhn.feign;

import com.lhn.entity.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author lhn
 * @date 2024-10-14 22:24
 */

@FeignClient(name = "order-provider")
public interface OrderFeign {
//    @GetMapping("/order/count")
//    int count();
//
//    @DeleteMapping("/order/deleteById/{id}")
//    void deleteById(@PathVariable("id") long id);

    @GetMapping("order/findAll/{index}/{limit}")
    List<Order> findAll(@PathVariable("index") int index, @PathVariable("limit") int limit);

//    @GetMapping("/order/findById/{id}")
//    Object findById(@PathVariable("id") long id);

    @PostMapping("order/save")
    void save(@RequestBody Object order);

    @GetMapping("order/count")
    int count();

    @GetMapping("order/countByUid/{uid}")
    int countByUid(@PathVariable("uid") long uid);

    @GetMapping("order/findAllByUid/{uid}/{index}/{limit}")
    List<Order> findAllByUid(@PathVariable("uid") long uid, @PathVariable("index") int index, @PathVariable("limit") int limit);

    @GetMapping("order/findAllByState/{state}/{index}/{limit}")
    List<Order> findAllByState(@PathVariable("state") int state, @PathVariable("index") int index, @PathVariable("limit") int limit);

    @GetMapping("order/countByState/{state}")
    int countByState(@PathVariable("state") int state);

    @PostMapping("order/updateState/{id}/{state}")
    void updateState(@PathVariable("id") long id, @PathVariable("state") int state);

    @GetMapping("order/findAllState/{index}/{limit}")
    List<Order> findAllState(@PathVariable("index") int index, @PathVariable("limit") int limit);
}
